package pushtest.mobike.com.mtpush

import android.annotation.TargetApi
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity;

import kotlinx.android.synthetic.main.activity_base_theme.*

open class BaseThemeActivity : AppCompatActivity() {
  val lightStatusBarSupported = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_base_theme)
    setSupportActionBar(toolbar)
  }

  fun setStatusBarTransparent() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      window.statusBarColor = Color.TRANSPARENT
    }
  }

  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  fun setStatusBarColorCompat(color: Int) {
    if (lightStatusBarSupported) {
      window.statusBarColor = color
    }
  }


}
